#!/bin/bash
#to combine the zero image
DIR_data=`pwd`
gain=2
rdnoise=10
listdark=$1
if [ $# -ne 1  ]
then
	echo "usage[xdarkcom.sh listdark]"
	exit 0
fi
rm -rf Dark.fit
#============================
cd $HOME/iraf1
cp -f login.cl.old login.cl
echo noao >> login.cl
echo imred >>login.cl
echo ccdred >>login.cl
echo "cd $DIR_data" >> login.cl
echo "darkcombine(input=\"@$listdark\", output=\"Dark.fit\",combine=\"average\",reject=\"minmax\",ccdtyp=\" \",process-,rdnoise=$rdnoise,gain=$gain,)" >>login.cl
echo logout >> login.cl
#cl < login.cl
cl < login.cl >xlogfile 
cd $HOME/iraf1
cp -f login.cl.old login.cl
cd $DIR_data
